﻿#include "TuxSpyTuxAlarmDlg.h"

TuxSpyTuxAlarmDlg::TuxSpyTuxAlarmDlg( wxWindow* parent )
:
TuxAlarmDlg( parent )
{

}

void TuxSpyTuxAlarmDlg::SetTuxAlarm( TuxAlarm tuxalarm )
{
	m_tuxalarm = tuxalarm;
}

TuxAlarm TuxSpyTuxAlarmDlg::GetTuxAlarm( )
{
	return m_tuxalarm;
}


void TuxSpyTuxAlarmDlg::OnInitDialog( wxInitDialogEvent& event )
{
	m_chkSvrDied->SetValue( !m_tuxalarm.SvrDied.empty() );
	m_txtSvrDiedList->WriteText( m_tuxalarm.SvrDied );

	m_chkNoTran->SetValue( !m_tuxalarm.NoTran.empty() );
	m_txtNoTranList->WriteText( m_tuxalarm.NoTran );

	m_chkLongBusy->SetValue( !m_tuxalarm.LongBusy.empty() );
	m_txtLongBusyList->WriteText( m_tuxalarm.LongBusy );

	m_chkQueuedThan->SetValue( !m_tuxalarm.Queued.empty() );
	m_txtQueuedThan->WriteText( m_tuxalarm.Queued );

	m_chkPlayMusic->SetValue( !m_tuxalarm.PlaySound.empty() );
	m_chkEmail->SetValue( !m_tuxalarm.Email.empty() );
	m_chkSMS->SetValue( !m_tuxalarm.SMS.empty() );

	return;
}

void TuxSpyTuxAlarmDlg::OnAlarmDlgOK( wxCommandEvent& event )
{
	//tuxalarmset
	if( m_chkSvrDied->IsChecked() )	m_tuxalarm.SvrDied = m_txtSvrDiedList->GetValue();
	else m_tuxalarm.SvrDied.Empty();

	if( m_chkNoTran->IsChecked() )	m_tuxalarm.NoTran = m_txtNoTranList->GetValue();
	else m_tuxalarm.NoTran.Empty();

	if( m_chkLongBusy->IsChecked() )	m_tuxalarm.LongBusy = m_txtLongBusyList->GetValue();
	else m_tuxalarm.LongBusy.Empty();

	if( m_chkQueuedThan->IsChecked() )	m_tuxalarm.Queued = m_txtQueuedThan->GetValue();
	else m_tuxalarm.Queued.Empty();

	if( m_chkPlayMusic->IsChecked() )	m_tuxalarm.PlaySound = wxT("TRUE");
	else m_tuxalarm.PlaySound.Empty();

	if( m_chkEmail->IsChecked() )	m_tuxalarm.Email = wxT("TRUE");
	else m_tuxalarm.Email.Empty();

	if( m_chkSMS->IsChecked() )	m_tuxalarm.SMS = wxT("TRUE");
	else m_tuxalarm.SMS.Empty();

	SetReturnCode( IDOK );
	Destroy();
}

void TuxSpyTuxAlarmDlg::OnButtonActSetClick( wxCommandEvent& event )
{
	FusionSpyActionDlg* actionSet = new FusionSpyActionDlg( this );

	//alarmSet->SetWlsAlarm( m_wlsalarm );

	if( actionSet->ShowModal() != IDOK ) return;
	//m_wlsalarm = alarmSet->GetWlsAlarm();

	//m_wlsalarm.SiteName = m_site.SiteName;
	//dbWrapper.WlsAlarmUpdate(m_wlsalarm);

}
